package com.study.d3_charset;

import java.util.Arrays;

public class Test {
    public static void main(String[] args) throws Exception {
        //掌握字符的编码和解码
        String s = "asda我在黑马5655学习！";

        //编码 默认UTF-8
        byte[] bytes = s.getBytes();
        System.out.println(Arrays.toString(bytes ));

        byte[] bytes2 = s.getBytes("GBK");
        System.out.println(Arrays.toString(bytes2));

        //解码
        String s1 = new String(bytes);
        System.out.println(s1);

        String s2 = new String(bytes2,"GBK");
        System.out.println(s2);
    }
}
